<template>
    <div class="w100 h100">
        <add
            :evaluationRecord="record"
            v-if="type === 'details' && record"
            @typeChange="typeChange"
            :isEdit="isEdit"
        ></add>
        <Table v-else @typeChange="typeChange"></Table>
    </div>
</template>

<script>
import Add from './components/Add.vue'
import Table from './components/Table.vue'
export default {
    components: {
        Add,
        Table,
    },
    data() {
        return {
            type: 'table',
            record: null,
            isEdit: true,
        }
    },
    methods: {
        typeChange(type, record, isEdit = true) {
            this.type = type
            if (type === 'details') {
                this.record = record
                this.isEdit = isEdit
            } else {
                this.record = null
            }
        },
    },
}
</script>

<style lang="scss" scoped></style>
